<template>
	<view class="u-m-t-30 u-m-l-20 u-m-r-20">
		<view class="u-card-box u-relative">
			<view class="u-flex u-p-b-20">
				<view @click="onPreviewHead">
					<u-image width="160rpx" height="160rpx" border-radius="20"
						:src="data.head_img"></u-image>
				</view>

				<view class="u-m-l-20 u-flex-1 u-flex-col u-row-between u-ellipsis">
					<view class="u-flex u-row-between">
						<view class="u-flex">
							<view class="u-m-r-10 u-font-34 u-font-bold">{{data.name}}</view>
							<!-- <view class="u-m-r-10" v-if="![0,'0'].includes(data.sex)">
								<u-icon size="32" :color="data.sex == 1 ? '#4399FF' : '#FF69B1'"
									:name="data.sex == 1 ? 'nanxing' : 'nvxing'" custom-prefix="custom-icon" />
							</view> -->
							<view class="u-m-r-10" v-if="data.is_authentication == 2">
								<u-icon size="32" color="#FB6316" name="renzheng" custom-prefix="custom-icon" />
							</view>
							<view class="u-m-r-10" v-if="data.is_company_user == 1">
								<u-icon size="32" color="#F8494D" name="qiye1" custom-prefix="custom-icon" />
							</view>
							<view class="u-tag-box" :class="data.president_class"
								v-if="[5,6,7,8].includes(data.president_status) && data.president_class">
								{{ getPresidentName(data.partner_status,data.president_status) }}

							</view>
						</view>
						<view class="edit_btn" v-if="isPromoter" @click="onEditUserInfo">修改</view>
					</view>
					<view class="u-m-t-5 u-font-24 u-color-gray">{{data.position || ''}}</view>
					<view class="u-m-t-5 u-font-24 u-color-gray">{{data.company || ''}}</view>
					<view class="u-m-t-10 hometown_tag">{{data.hometown}}</view>
				</view>
			</view>
			<view>
				<view class="u-m-t-20 u-p-b-10 u-flex u-row-around u-width-100">
					<view class="u-text-center">
						<view class="u-color-gray u-font-24">能量值</view>
						<view class="u-font-bold u-font-40 u-m-t-10">{{data.number || 0}}</view>
					</view>
					<view class="line"></view>
					<view class="u-text-center">
						<view class="u-color-gray u-font-24">举办酒局</view>
						<view class="u-font-bold u-font-40 u-m-t-10">{{data.data_num.space || 0}}场</view>
					</view>
					<view class="line"></view>
					<view class="u-text-center">
						<view class="u-color-gray u-font-24">参加酒局</view>
						<view class="u-font-bold u-font-40 u-m-t-10">{{data.data_num.join_num || 0}}场</view>
					</view>
				</view>
			</view>

			<!-- <view class="u-m-t-20 u-font-desc">
				<view class="u-m-t-10">
					<span class="u-color-gray">电话：</span>
					<span>{{data.phone}}</span>
				</view>
				<view class="u-m-t-10" v-if="data.industry_names[0]">
					<span class="u-color-gray">行业：</span>
					<span>{{data.industry_names[0]}}</span>
				</view>
				<view class="u-m-t-10" v-if="data.company">
					<span class="u-color-gray">公司：</span>
					<span>{{data.company}}</span>
				</view>
				<view class="u-m-t-10" v-if="data.position">
					<span class="u-color-gray">职位：</span>
					<span>{{data.position}}</span>
				</view>
				<view class="u-m-t-10" v-if="data.bussiness_card.product">
					<span class="u-color-gray">产品：</span>
					<span>{{data.bussiness_card.product}}</span>
				</view>
				<view class="u-m-t-10" v-if="data.bussiness_card.resume">
					<span class="u-color-gray">主要经历：</span>
					<span>{{data.bussiness_card.resume}}</span>
				</view>
				<view class="u-m-t-10" v-if="data.bussiness_card.honor">
					<span class="u-color-gray">荣誉：</span>
					<span>{{data.bussiness_card.honor}}</span>
				</view>
				<view class="u-m-t-10" v-if="data.bussiness_card.hobby">
					<span class="u-color-gray">爱好：</span>
					<span>{{data.bussiness_card.hobby}}</span>
				</view>
				<view class="u-m-t-10" v-if="data.bussiness_card.motto">
					<span class="u-color-gray">座右铭：</span>
					<span>{{data.bussiness_card.motto}}</span>
				</view>
				<view class="u-m-t-10" v-if="data.bussiness_card.specialty">
					<span class="u-color-gray">特长：</span>
					<span>{{data.bussiness_card.specialty}}</span>
				</view>
				<view class="u-m-t-10 u-text-line-15" v-if="data.bussiness_card.company_des">
					<view class="u-color-puce u-font-bold">企业简介：</view>
					<text :user-select="true" class="u-text-line-15 u-flex-1">{{data.bussiness_card.company_des}}</text>
				</view>

				<view class="u-m-t-10 u-text-line-15" v-if="data.bussiness_card.personal_advantage">
					<view class="u-color-puce u-font-bold">个人优势：</view>
					<text :user-select="true"
						class="u-text-line-15 u-flex-1">{{data.bussiness_card.personal_advantage}}</text>
				</view>
				<view class="u-m-t-10 u-text-line-15" v-if="data.bussiness_card.recommend">
					<view class="u-color-puce u-font-bold">需要引荐的资源：</view>
					<text :user-select="true" class="u-text-line-15 u-flex-1">{{data.bussiness_card.recommend}}</text>
				</view>
			</view> -->
		</view>
		<view class="u-m-t-30" v-if="data.businessImageList[0]">
			<u-swiper :height="360" :list="data.businessImageList" @click="onViewImage"></u-swiper>
		</view>
		<!-- 1 -->
		<view class="u-m-t-20" v-if="data.bussiness_card.video_text[0]">
			<view class="u-form-box u-p-t-20 u-p-b-20">
				<view class="title">宣传视频</view>
				<view class="desc">
					<video :src="data.bussiness_card.video_text[0]" class="u-width-100"></video>
				</view>
			</view>
		</view>
		<!-- 2 -->
		<view class="u-m-t-20" v-if="data.bussiness_card.personal_advantage || data.bussiness_card.recommend">
			<view class="u-form-box u-p-t-20 u-p-b-20">
				<view class="u-line-bottom u-p-b-20 u-m-b-30" v-if="data.bussiness_card.personal_advantage">
					<view class="title">个人优势</view>
					<view class="desc">
						<u-parse :html="data.bussiness_card.personal_advantage"></u-parse>
					</view>
				</view>
				<view v-if="data.bussiness_card.recommend">
					<view class="title">需要的引荐</view>
					<view class="desc">
						<u-parse :html="data.bussiness_card.recommend"></u-parse>
					</view>
				</view>
			</view>
		</view>
		<!-- 3 -->
		<view class="u-m-t-20" v-if="data.bussiness_card.company_des || data.industry_names[0] || data.bussiness_card.product">
			<view class="u-form-box u-p-t-20 u-p-b-20">
				<view class="u-line-bottom u-p-b-20 u-m-b-30" v-if="data.bussiness_card.company_des">
					<view class="title">企业简介</view>
					<view class="desc">
						<u-parse :html="data.bussiness_card.company_des"></u-parse>
					</view>
				</view>
				<view v-if="data.bussiness_card.product || data.industry_names[0]">
					<view class="title">行业及产品</view>
					<view class="desc">
						<view>{{data.industry_names[0]}}</view>
						<view class="u-m-t-5">{{data.bussiness_card.product}}</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 4 -->
		<view class="u-m-t-20" v-if="data.bussiness_card.specialty || data.bussiness_card.hobby || data.bussiness_card.motto || data.bussiness_card.resume || data.bussiness_card.honor">
			<view class="u-form-box u-p-t-20 u-p-b-20">
				<view class="u-line-bottom u-p-b-20 u-m-b-30" v-if="data.bussiness_card.specialty">
					<view class="title">专长</view>
					<view class="desc">{{data.bussiness_card.specialty}}</view>
				</view>
				<view class="u-line-bottom u-p-b-20 u-m-b-30" v-if="data.bussiness_card.hobby">
					<view class="title">爱好</view>
					<view class="desc">{{data.bussiness_card.hobby}}</view>
				</view>
				<view class="u-line-bottom u-p-b-20 u-m-b-30" v-if="data.bussiness_card.motto">
					<view class="title">座右铭</view>
					<view class="desc">{{data.bussiness_card.motto}}</view>
				</view>
				<view class="u-line-bottom u-p-b-20 u-m-b-30" v-if="data.bussiness_card.resume">
					<view class="title">主要经历</view>
					<view class="desc">
						<u-parse :html="data.bussiness_card.resume"></u-parse>
					</view>
				</view>
				<view class="u-line-bottom u-p-b-20" v-if="data.bussiness_card.honor">
					<view class="title">荣誉</view>
					<view class="desc">
						<u-parse :html="data.bussiness_card.honor"></u-parse>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		PresidentLevel,
    TeaStatus
	} from '@/utils/index.js'
	export default {
		props: {
			data: {
				type: Object
			},
			// 是否是展厅主
			isPromoter: {
				type: Boolean,
				default: false
			}
		},
		methods: {
			getPresidentName(status1, status2) {
        return TeaStatus(status1, status2)  
				// return PresidentLevel(status)
			},
			onEditUserInfo() {
				this.$emit("onEditUserInfo")
			},
			switchThanksList() {
				this.$emit("switchThanksList")
			},
			chooseThank() {
				this.$emit("chooseThank")
			},
			onViewImage(index){
				let list = []
				this.data.businessImageList.map(item=>list.push(item.image))
				uni.previewImage({
					current: index,
					urls: list
				})
			},
			onPreviewHead(){
				let list = []
				list.push(this.data.head_img)
				uni.previewImage({
					current: 0,
					urls: list
				})
			}
		}
	}
</script>

<style lang="scss">
	.edit_btn {
		background: #FC5D01;
		color: #fff;
		padding: 15rpx 20rpx;
		font-size: 26rpx;
		position: absolute;
		right: 0;
		top: 0;
		border-radius: 0rpx 10rpx 0rpx 15rpx;
	}

	.hometown_tag {
		background: #E0CCB3;
		color: #A18A63;
		border-radius: 10rpx;
		padding: 3rpx 18rpx;
		font-size: 24rpx;
		width: fit-content;
	}

	.desc {
		margin-top: 30rpx;
	}

	.title {
		color: #B3723E;
		font-size: 30rpx;
		font-weight: bold;
		position: relative;
		padding-left: 20rpx;
	}

	.title::before {
		content: "";
		position: absolute;
		top: 10%;
		bottom: 0;
		left: 0;
		width: 4px;
		height: 80%;
		background-color: #B3723E;
	}
</style>